#include "Globals.h"

  extern REGZ reg            = { 0 };
  extern BYTE *rom           = NULL;
  extern BYTE *ram           = NULL;
  extern FILE *rf            = NULL;
  extern FILE *df            = NULL;
  extern BYTE buf[4][32]     = { 0 };
  extern char romf[MAXPATH]  = { 0 };
  extern char datf[MAXPATH]  = { 0 };
  extern char dirc[MAXPATH]  = { 0 };  

  extern LONG FSize          = 0;
  extern WORD valu           = 0;
  extern WORD z              = 0;



//-----------------------------//
// Load the program data Bank  //
//-----------------------------//
LONG Snes2Pc( LONG ofs )
{
  LONG val;

  if ( !ofs ) return 0;

  // SNES to ROM
  val = (((ofs | 0x800000) - 0x800000) & 0xFF0000) >> 1;
  val+= ((ofs & 0xFFFF) - 0x8000);

  return val;
}// END


//-----------------------------//
// Get the length of the file  //
//-----------------------------//
LONG FileSize( FILE *tf )
{
 LONG val,
			offset;

 // Test file
 if ( !tf )  return -1;

 // Get size
 offset = ftell( tf );
 fseek( tf, 0, SEEK_END );
 val    = ftell( tf );
 fseek( tf, offset, SEEK_SET );

 return val;
}// END OF SUB


